# -*- coding: utf-8  -*-
#!/usr/local/bin/python

__author__ = 'jian.yao'

from django.db import models
from cm.appserver.constants import AppServerType, AppServerStatus
class AppServer(models.Model):
    id              = models.IntegerField(null=False, blank=False, primary_key=True)
    idc             = models.IntegerField(null=False, blank=False, default=1)
    host            = models.CharField(null=False, blank=False, max_length=255)
    port            = models.IntegerField(null=False, blank=False)
    lan_ip          = models.CharField(null=False, blank=False, max_length=255)
    wan_ip          = models.CharField(null=False, blank=False, max_length=255)
    public_key      = models.CharField(null=False, blank=False, max_length=255)
    secret_key      = models.CharField(null=False, blank=False, max_length=255)
    server_type     = models.IntegerField(null=False, blank=False, default=AppServerType.APPServer)
    description     = models.CharField(null=True, blank=True, max_length=255)
    status          = models.IntegerField(null=False, blank=False, default=AppServerStatus.Unavailable)
    creator         = models.IntegerField(null=False, blank=False, default=1)
    create_time     = models.DateTimeField(auto_now_add=True)
    last_editor     = models.IntegerField(null=False, blank=False, default=1)
    last_update     = models.DateTimeField(auto_now=True)

